/**
 * @Author: wangjian
 * 656876071@qq.com
 * @Date: 2024年8月8日 15:33:50
 * @LastEditTime: 2024年8月8日 15:33:50
 * @FilePath: src/views/system/api/SysUserApi.ts
 * @Description:
 */
import r from '@/core/utils/request'

export interface SysUser {
         userId? : string;
         loginName? : string;
         nickName? : string;
         password? : string;
         phone? : string;
         avatar? : string;
         deptId? : string;
         jobId? : string;
         status? : string;
         delFlag? : string;
         remark? : string;
         createdBy? : string;
         createdTime? : string;
         updatedBy? : string;
         updatedTime? : string;

    [key:string]:any
}

export default () => {
    return {
        getPage: ({params: queryParams = {}, current = 1, size = 10}) => {
            return r.get('sys/user/page', {
                params: {
                    current,
                    size,
                    ...queryParams
                }
            })
        }
        ,
        getById: (id: string) => {
            return r.get(`sys/user/${id}`)
        },
        add:
            (rawObject: SysUser) => {
                return r.post('sys/user', rawObject)
            },
        update:
            (rawObject: SysUser) => {
                return r.put(`sys/user`, rawObject)
            }
            ,
        deleteById:
            (id: string) => {
                return r.delete(`sys/user/${id}`)
            },
    }
}